<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>根据当前时间显示问候语</title>
	</head>
	<body onload="show()">
		<h3 id="id1"></h3>
		<h3 id="id2"></h3>
		<h3 id="id3"></h3>
		<script>
			
			function show(){
				var today=new Date();
				var str;
				var year=today.getFullYear();
				var month=today.getMonth()+1;
				var day=today.getDate();
				
				var hour=today.getHours();
				var minute=today.getMinutes();
				if(hour<12){
					str="早上好！";
				}else if(hour<=18){
					str="下午好！";
				}else{
					str="晚上好！";
				}
				document.getElementById("id1").innerHTML="今天日期是："+year+"年"+month+"月"+day+"日";
				document.getElementById("id2").innerHTML="现在时间是："+hour+"点"+minute+"分";
				document.getElementById("id3").innerHTML=str+"欢迎来到贵美！";
			}
		</script>
	</body>
</html>
